<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/8/23
 * Time: 10:53
 */

namespace app\home\controller;


use think\Db;

class Group extends Base
{
    public function index()
    {
        $id = input('id');
        if (Db::name('goods_group')->where(array('id' => $id, 'pid' => '0'))) {

            $group_ids = Db::name('goods_group')->where(array('pid'=>$id))->column('id');
            $group_id = implode(',', $group_ids);
            $where['pid'] = array('in',$group_id);
        } else {
            $where['pid'] = $id;
        }
        $where['end_time'] = array('>', time());
        $list = Db::name('user')->where($where)->select();

        $map = array('list' => $list);

        return view('index', $map);
    }

}